﻿<%@ CODEPAGE=65001 %>
<%
'///////////////////////////////////////////////////////////////////////////////
'// 插件应用:    Z-Blog 2.0 其它版本未知
'// 插件制作:    狼的旋律(http://www.wilf.cn) / zsx(http://www.zsxsoft.com)
'// 备    注:    后台首页
'// 最后修改:
'// 最后版本:
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% 'On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="../../c_option.asp" -->
<!-- #include file="../../../zb_system/function/c_function.asp" -->
<!-- #include file="../../../zb_system/function/c_system_lib.asp" -->
<!-- #include file="../../../zb_system/function/c_system_base.asp" -->
<!-- #include file="../../../zb_system/function/c_system_plugin.asp" -->
<!-- #include file="../p_config.asp" -->
<%
Call System_Initialize()
Call WindsPhoto_Initialize()

Call CheckReference("")

If BlogUser.Level>2 Then Call ShowError(6)
If CheckpluginState("windsphoto") = False Then Call ShowError(48)

BlogTitle = "WindsPhoto 相册管理"
%>
<!--#include file="..\..\..\zb_system\admin\admin_header.asp"-->
<style>
img.wp_top{margin:0 0 5px 0;max-width:<%=WP_SMALL_WIDTH%>px;max-height:<%=WP_SMALL_HEIGHT%>px;}
</style>
<!--#include file="..\..\..\zb_system\admin\admin_top.asp"-->
<div id="divMain"><div id="ShowBlogHint"><%Call GetBlogHint()%></div>
	<div class="divHeader">WindsPhoto 相册管理</div>
    <div class="SubMenu"><%=WindsPhoto_SubMenu(0)%></div>
    <div id="divMain2">
		<script type="text/javascript">ActiveLeftMenu("aWindsPhoto")</script>
<%
Dim temprs,sm,rs,sql,surl,pass,i,ipagecount,ipagecurrent,irecordsshown,a,b

If request.querystring("page") = "" Then
	ipagecurrent = 1
Else
	ipagecurrent = CInt(request.querystring("page"))
End If

Set temprs = objConn.Execute("select count(*) as C FROM WindsPhoto_desktop")
sm = temprs("c")

sql = "select * FROM WindsPhoto_zhuanti order by ordered,id asc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.pagesize = 18
rs.Open sql, objConn, 1, 1
ipagecount = rs.pagecount
If ipagecurrent > ipagecount Then ipagecurrent = ipagecount
If ipagecurrent < 1 Then ipagecurrent = 1
If ipagecount = 0 Then
	Response.Write "<p align='center'>还没有相册>>><a href='admin_addtype.asp'>赶快添加一个新相册</a></p>"
Else
	Response.Write"<p>截止到 "&Now()&"，共有"&rs.RecordCount&"个相册，"&sm&"张图片。 <a href='admin_cmd.asp?action=updatecache'><span style='color:red'>更新缓存↓</span></a></p>"
	Response.Write"<table width='100%' border='0' cellspacing='0' cellpadding='5'>"
	rs.absolutepage = ipagecurrent
	irecordsshown = 0
	Do While irecordsshown<18 And Not rs.EOF
		Response.Write"<tr align='center'>"

		For i = 1 To 3

			If Not rs.EOF Then
				'获取相册封面
				Set temprs = objConn.Execute("select top 1 * FROM WindsPhoto_desktop where zhuanti="&rs("id")&" and hot<>0 order by id asc")
				If temprs.EOF Or temprs.bof Then
					surl = "images/notop.gif"
				Else
					surl = temprs("surl")
				End If
				'获取加密相册封面
				Set temprs = objConn.Execute("select pass FROM WindsPhoto_zhuanti where id="&rs("id")&"")
				pass = temprs("pass")
				If pass<>"" Then
					surl = "images/nopass.gif"
				End If
				Response.Write"<td width='33%'><a href='admin_addphoto.asp?typeid="&rs("id")&"'><img class='wp_top' src='"&surl&"' /></a><div>["&rs("ordered")&"]<a href='"&WP_SUB_DOMAIN&"album.asp?typeid="&rs("id")&"' target='_blank'>"&rs("name")&"</a> | <a href='admin_edittype.asp?typeid="&rs("id")&"'>修改/删除</a> | <a href='admin_addphoto.asp?typeid="&rs("id")&"'><font color=red>上传/管理</font></a></div></td>"
				irecordsshown = irecordsshown + 1
				rs.movenext
			End If

		Next

		Response.Write"</tr>"
	Loop

	Response.Write"</table><hr/>"

	If ipagecount >1 then
		Response.Write"<p class=""pagebar"">分页：<a title='首页' href='?&page=1'>1</a> "
		If ipagecurrent=1 then
			Response.Write"<a title='上一页'>«</a> "
		Else
			Response.Write"<a href='?page="&ipagecurrent-1&"' title='上一页'>«</a> "
		End If

		If ipagecount>ZC_PAGEBAR_COUNT Then
			a=ipagecurrent-Cint((ZC_PAGEBAR_COUNT-1)/2)
			b=ipagecurrent+ZC_PAGEBAR_COUNT-Cint((ZC_PAGEBAR_COUNT-1)/2)-1
			If a<=1 Then
				a=1:b=ZC_PAGEBAR_COUNT
			End If
			If b>=ipagecount Then
				b=ipagecount:a=ipagecount-ZC_PAGEBAR_COUNT+1
			End If
		Else
			a=1:b=ipagecount
		End If

		For i = a to b
			If ipagecurrent = i Then
				Response.Write"<span>"&i&"</span> "
			Else
				Response.Write"<a href='?page="&i&"'>"&i&"</a> "
			End If
		Next

		If ipagecount>ipagecurrent then
			Response.Write"<a href='?page="&ipagecurrent+1&"' title='下一页'>»</a> "
		Else
			Response.Write"<a title='下一页'>»</a> "
		End If

		Response.Write"<a title='尾页' href='?page="&ipagecount&"'>"&ipagecount&"</a></p>"

	End If

End If
rs.Close
Set rs = Nothing
%>
    </div>
</div>
<!--#include file="..\..\..\zb_system\admin\admin_footer.asp"-->
<%Call System_Terminate()%>